package demo.practice.bit;

public class P201 {


    public static void main(String[] args) {
        P201 p201= new P201();
        p201.rangeBitwiseAnd(2147483646,2147483647);
    }

    public int rangeBitwiseAnd(int left, int right) {
        int res=(1<<31)-1;
        for(int i=left;i<=right&& i>=0;i++){
            if(res==0)
                return 0;
            res&=i;
        }
        return res;
    }
}
